<template>
    <!-- 表格 -->
    <el-table
      stripe
      :data="datalist"
      highlight-current-row
      @row-click="showDetails"
      row-class-name="link"
      :element-loading-text="$I18n.loading">
      <!-- 下单号 -->
      <el-table-column prop="applyId" :label="$I18n.applyId"></el-table-column>
       <!-- 站点 -->
      <el-table-column prop="site" :label="$I18n.site"></el-table-column>
       <!-- 店铺 -->
      <el-table-column prop="shopName" :label="$I18n.shopName"></el-table-column>
       <!-- 客户 -->
      <el-table-column prop="productBelongUser" :label="$I18n.productBelongUser"></el-table-column>
       <!-- 处理人 -->
      <el-table-column prop="optionUserName" :label="$I18n.optionUserName"></el-table-column>
       <!-- 产品名称 -->
      <el-table-column prop="productName" :label="$I18n.productName"></el-table-column>
      <!-- assin -->
      <el-table-column prop="assin" :label="$I18n.assin"></el-table-column>
      <!-- 下单日期 -->
      <el-table-column prop="applyDate" :label="$I18n.applyDate"></el-table-column>
      <!-- 期望留评日期 -->
      <el-table-column prop="expectCommentDate" :label="$I18n.expectCommentDate"></el-table-column>
      <!-- 产品价格 -->
      <el-table-column prop="price" :label="$I18n.price"></el-table-column>
      <!-- 测评数量 -->
      <el-table-column prop="mult" :label="$I18n.mult"></el-table-column>
       <!-- 业务类型 -->
      <el-table-column prop="businessType" :label="$I18n.businessType"></el-table-column>
       <!-- 状态 -->
      <el-table-column prop="applyStatus" :label="$I18n.status"></el-table-column>
    </el-table>
</template>

<script>
import INTERFACE from '../interface'
import EventBus from '@/services/eventBus'

export default {
  // tagsInfo：搜索条件，传给后端，获取表格数据
  props: ['tagsInfo'],
  data() {
    return {
      datalist: [],        // 表格数据
      loading: true
    }
  },
  methods: {
    // 查看详情
    showDetails(row, column, event) {
      this.$router.push({
        path: '/applyUpdate',
        query: {applyId: row.applyId}
      })
    }
  },
  mounted() {
  },
  watch: {
    tagsInfo: {
      handler(newValue) {
        // 根据搜索条件获取表格数据
        INTERFACE.getBusinessCheck(this.tagsInfo).then(res => {
          this.datalist = res.data.data || []
          // 通知分页组件总共条数
          EventBus.$emit('pageData', {totalPage: res.data.totalPage, currentPage: res.data.currentPage})
        }).catch(() => {
          this.datalist = []
        })
      },
      deep: true,
      immediate: true
    }
  }
}
</script>
<style lang="stylus">
</style>
